package com.ruoyi.web.controller.net;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.net.domain.BusiMtnGroupPort;
import com.ruoyi.net.domain.BusiMtnGroupPortListVo;
import com.ruoyi.net.service.IBusiMtnGroupPortService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 业务-mtnGroup配置端口信息Controller
 * 
 * @author net
 * @date 2024-12-07
 */
@Api(tags = "业务-mtnGroup配置端口信息")
@RestController
@RequestMapping("/busi/mtn/group/port")
public class BusiMtnGroupPortController extends BaseController
{
    @Autowired
    private IBusiMtnGroupPortService busiMtnGroupPortService;

    /**
     * 查询业务-mtnGroup配置端口信息列表
     */
    @ApiOperation(value = "查询业务-mtnGroup配置端口信息列表", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:port:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusiMtnGroupPort busiMtnGroupPort)
    {
        startPage();
        List<BusiMtnGroupPortListVo> list = busiMtnGroupPortService.selectBusiMtnGroupPortList(busiMtnGroupPort);
        return getDataTable(list);
    }

    /**
     * 导出业务-mtnGroup配置端口信息列表
     */
    @ApiOperation(value = "导出业务-mtnGroup配置端口信息列表", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:port:export')")
    @Log(title = "业务-mtnGroup配置端口信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusiMtnGroupPort busiMtnGroupPort)
    {
        List<BusiMtnGroupPortListVo> list = busiMtnGroupPortService.selectBusiMtnGroupPortList(busiMtnGroupPort);
        ExcelUtil<BusiMtnGroupPortListVo> util = new ExcelUtil<BusiMtnGroupPortListVo>(BusiMtnGroupPortListVo.class);
        util.exportExcel(response, list, "业务-mtnGroup配置端口信息数据");
    }

    /**
     * 获取业务-mtnGroup配置端口信息详细信息
     */
    @ApiOperation(value = "获取业务-mtnGroup配置端口信息详细信息", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:port:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busiMtnGroupPortService.selectBusiMtnGroupPortById(id));
    }

    /**
     * 新增业务-mtnGroup配置端口信息
     */
    @ApiOperation(value = "新增业务-mtnGroup配置端口信息", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:port:add')")
    @Log(title = "业务-mtnGroup配置端口信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusiMtnGroupPort busiMtnGroupPort)
    {
        return toAjax(busiMtnGroupPortService.insertBusiMtnGroupPort(busiMtnGroupPort));
    }

    /**
     * 修改业务-mtnGroup配置端口信息
     */
    @ApiOperation(value = "修改业务-mtnGroup配置端口信息", httpMethod = "PUT")
    @PreAuthorize("@ss.hasPermi('net:port:edit')")
    @Log(title = "业务-mtnGroup配置端口信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusiMtnGroupPort busiMtnGroupPort)
    {
        return toAjax(busiMtnGroupPortService.updateBusiMtnGroupPort(busiMtnGroupPort));
    }

    /**
     * 删除业务-mtnGroup配置端口信息
     */
    @ApiOperation(value = "删除业务-mtnGroup配置端口信息", httpMethod = "DELETE")
    @PreAuthorize("@ss.hasPermi('net:port:remove')")
    @Log(title = "业务-mtnGroup配置端口信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busiMtnGroupPortService.deleteBusiMtnGroupPortByIds(ids));
    }
}
